package com.ml.shs.repository;

import com.ml.shs.entity.Goods;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import java.util.List;

public interface GoodsRepository extends MongoRepository<Goods, String> {

    @Query(value = "{ state:{$ne: '-1'}}", sort = "{state: 1, createTime: -1}")
    public List<Goods> findGoodsList();

    @Query(value = "{ state:{$ne: '-1'}, classify: ?0}", sort = "{state: 1, createTime: -1}")
    public List<Goods> findGoodsListByClassify(String classifyId);

    public  List<Goods> findAllByCreaterId(String userId);

}
